<!--
/* 
 * joblist - A Jobs Posting Application
 * $Id: joblist.jsp,v 1.3 2006/04/15 05:15:05 biglee Exp $
 * 
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is the JUGJobs project.
 *
 * The Initial Developers of the Original Code are the members of the Triangle
 * Java User's Group in the RTP area of North Carolina.
 * Portions created by the Initial Developer are Copyright (C) 2005
 * the Initial Developers. All Rights Reserved.
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** 
 */
 -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/tags/struts-html" 				   prefix="html" %>
<%@ taglib uri="/tags/struts-bean" 				   prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" 			   prefix="logic" %>


<HTML:html>

	<!-- User-provided header 
	     TODO: Consider using Tiles instead of this include... -->
	<jsp:include page='/WEB-INF/userPages/userHead.jsp'/>
	<!-- End of user-provided header -->

	<%-- we often re-enter this from another place that has set the 
		attribute 'currentJobBean' to something.  When we start this
		list, we don't want the 'currentJobBean' to exist any more,
		so we remove it.
	-->
	<logic:present name='currentJobBean'>
		session.removeAttribute('currentJobBean');
	</logic:present>

     <%-- put a table heading and whatever links we want at the top --%>
     <TABLE>
       <TR>
          <TD WIDTH=65%>
            <H2 ALIGN="center"><bean:message key="jugjobs.joblist.title"/></H2>
          </TD>
       
          <TD>
            <UL>
              <LI><html:link href="createJob.do">
              		<bean:message key="jugjobs.joblistlinktext.addjob"/>
              	   </html:link>
                
                <%-- a link for an admin to either log in or log out --%> 
                <logic:equal name="ADMIN_LOGGED_IN" scope="session" value="ADMIN_LOGGED_IN">
	                <li><html:link href="adminLogout.do">
	                	  <bean:message key="jugjobs.joblistlinktext.adminLogout"/>
	                	</html:link>
                </logic:equal>
                
                <logic:notEqual name="ADMIN_LOGGED_IN" scope="session" value="ADMIN_LOGGED_IN">
	                <LI><html:link href="getAdminLogin.do">
	                	  <bean:message key="jugjobs.joblistlinktext.adminLogin"/>
	                	</html:link>
                </logic:notEqual>
            </UL>
          </TD>
       </TR>
     </TABLE>
    
    <jsp:useBean id='modelBean' scope='application' class='org.jugjobs.model.JobList'/>
    
    <%-- This is the 'compact' jobs listing --%>
    <%-- The idea is to give the user enough info to know whether he wants more; we provide a link to the full
          info for each job, and a link to the employer's website if we have that.
     --%> 

    <table border="2" width='95%' align-'center'>
        <TR>
          <TH><bean:message key="jugjobs.jobFieldHeader.company"/></TH> 
          <th><bean:message key="jugjobs.jobFieldHeader.age"/></TH> 
          <TH><bean:message key="jugjobs.jobFieldHeader.jobTitle"/></TH> 
          <TH><bean:message key="jugjobs.jobFieldHeader.summary"/></TH>
        </TR>
      
      <logic:iterate name='modelBean' property='postingsList' id='jobN'>
        <TR>
          
          <%-- write the employer name; 
               if we have an employer website, make the employer name a link
          --%>
          <TD>
              <logic:notEmpty name='jobN' property='employer_url'>
                <A HREF="http://<bean:write name='jobN' property='employer_url'/>" target='_blank'>
                  <bean:write name="jobN" property="employer_name"  />* 
                </A>
              </logic:notEmpty>
              <logic:empty name='jobN' property='employer_url'>
                <bean:write name="jobN" property="employer_name"  /> 
              </logic:empty>
          </TD>


          <TD align="center"> <bean:write name="jobN" property="ageInDays"      /> </TD>
          
          <%-- write the job title as a link to the page that displays one job's info --%>
          <%-- include the array position, as the link page uses it to get to the job in ModelBean --%>
          <%-- TODO figure out if we should be using job number instead --%> 
          <TD><A HREF="displayJob.do?job_number=<bean:write name='jobN' property='job_number' />">
          <bean:write name="jobN" property="job_title" /> 
          </A></TD>

          <TD><bean:write name="jobN" property="job_summary" filter="false" /> </TD>
        
          </TR>
      </logic:iterate>
    </table>
    <br><i><bean:message key="jugjobs.joblist.joblistinstructions"/></i>
    <br><i><bean:message key="jugjobs.joblist.linknote"/></i>

	<!-- User-provided footer 
	     TODO: Consider using Tiles instead of this include... -->
	<jsp:include page='/WEB-INF/userPages/userFoot.jsp'/>
	<!-- End of user-provided footer -->

</HTML:html>

